package com.sjzl.filter;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter;

/**
 * @author  黄博文
 * @version 20119:43:53 AM
 * 
 */
public class MyStruts2Filter extends StrutsPrepareAndExecuteFilter {
	@Override
	public void doFilter(ServletRequest req, ServletResponse res,
			FilterChain chain) throws IOException, ServletException {
		HttpServletRequest request = (HttpServletRequest) req;
		//如果是Fckeditor的文件上传请求，这一律放过
		if (request.getRequestURI().indexOf(
				"fckeditor/editor/filemanager/connectors") != -1) {
			chain.doFilter(req, res);
		}else if(request.getRequestURI().indexOf("FileUploadServlet")!=-1){//如果是用户上传附件请求一律放过
			chain.doFilter(req, res);
		} else {
			super.doFilter(req, res, chain);
		}
	}
}

